package com.cc.utils.poi.dao.excellbasic;

import lombok.Data;

/**
 * @User c.c
 * @Since 2022/12/6
 * @Time 14:52
 * @Description 行基本元素
 */
@Data
public class RowCell {
  //起始位置
  private  Integer start;
  //结束位置
  private  Integer end;

  private RowCell(Integer start, Integer end) {
    this.start = start.equals(0) ? 0 : start - 1;
    this.end = end.equals(0) ? 0 : end - 1;
  }

  private RowCell() {
    this.start = 0;
    this.end = 0;
  }

  /**
   * @author C.c
   * @since 2022-12-07 12:00
   * @param sameRow 相同行
   **/
  private RowCell(Integer sameRow) {
    this.start = sameRow.equals(0) ? 0 : sameRow - 1;
    this.end = sameRow.equals(0) ? 0 : sameRow - 1;
  }

  /**
   *
   * @author C.c
   * @since 2022-12-07 14:09
   * @param startMerge 开始合并行
   * @param endMerge 结束合并行
   * @return RowCell
  **/
  public static RowCell intiRow(Integer startMerge,Integer endMerge){
    return new RowCell(startMerge,endMerge);
  }
  public static RowCell intiRow(Integer sameRow){
    return intiRowSame(sameRow);
  }

  /**
   *
   * @author C.c
   * @since 2022-12-07 14:09
   * @param sameRow 相同行
   * @return RowCell
   **/
  private static RowCell intiRowSame(Integer sameRow){
    return new RowCell(sameRow);
  }
}
